<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.io.FileReader" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.FileNotFoundException" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./Build/Cesium/Cesium.js"></script>

    <link rel="stylesheet" href="Build/Cesium/Widgets/widgets.css">
    <style>
        html,
        body,
        #cesiumContainer {
            width: 100%;
            height: 100%;
            margin: 0px;
        }

        .cesium-widget-credits {
            display: none !important;
            /*去除Cesium默认版权信息*/
        }

        .tool-bar {
            position: absolute;
            top: 1vh;
            left: 2vw;
            z-index: 999999;
        }

        .cesium-viewer-infoBoxContainer {
            display: none !important;
        }
    </style>

</head>
<%!
    public static class ReadColor{
        public static int[][] readColor() throws IOException {
        int[][] color = new int[256][4];
        BufferedReader atb = new BufferedReader(new FileReader("D:\\idea\\Cesium_new1\\color.txt"));//读取颜色数据
        for (int i = 0; i < 256; i++) {
            String str = atb.readLine();
            String[] temp = str.split("].FromArgb");
            //System.out.println(temp[1]);
            String[] temp1 = temp[1].split("\t");
            color[i][0] = Integer.valueOf(temp1[1]);
            color[i][1] = Integer.valueOf(temp1[2]);
            color[i][2] = Integer.valueOf(temp1[3]);
        }
        atb.close();
        return color;
    }
    }
    public static  class ReadRsrp{
        public static String[] rsrp() throws IOException {
            String[] rsrp=new String[242725];//242725
            BufferedReader at = new BufferedReader(new FileReader("D:\\idea\\Cesium_new1\\tras_new.txt"));
            for (int i = 0; i <242725 ; i++) {
               String str= at.readLine();
               rsrp[i]=str;
            }
            at.close();
            return rsrp;

        }

    }
%>
<%


    int[][] color =new int[256][4];
    color=ReadColor.readColor();
    for (int i = 0; i <255 ; i++) { //透明设置
        color[i][3]=250;
    }
    //把颜色配置写在color数组中
    int[] rsrp=new int[242725];
    for (int m = 0; m <242725 ; m++) {
        rsrp[m]=Integer.valueOf(ReadRsrp.rsrp()[m]);
        //System.out.println(rsrp[m]);
    }


//    for (int p = 0; p <255 ; p++) {   //color测试成功
//        for (int l = 0; l <3; l++) {
//            System.out.print(color[p][l]);
//            System.out.println(" ");
//
//        }
//        System.out.println(" ");
//
//    }
    //System.out.println(color[10][2]);  // color测试成功 %>
<body>
<div id="cesiumContainer"></div>

<script>
    //TOKEN信息
    Cesium.Ion.defaultAccessToken ='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhODk2YmYzZi02Nzk3LTQxNjctODM0Ni' +
        '01OGVhNTE4MzBlOTgiLCJpZCI6NDMzMjksImlhdCI6MTYxMjQ0MTg5NX0.3iByuAIc6Duo8_7SAscI7DOAzT-AFTM-4OIDfK5iOnA';
    //初始化cesium容器
    var viewer = new Cesium.Viewer("cesiumContainer", {
        homeButton: false,//是否显示Home按钮
        animation: false,//是否显示动画控件
        timeline: false,//是否显示时间线控件
        fullscreenButton: false,
        baseLayerPicker: false,//是否显示图层选择控件
        sceneModePicker: true, //是否显示投影方式控件
        navigationHelpButton: false, //是否显示帮助信息控件
        geocoder: false, //是否显示地名查找控件
        sceneModePicker: false,//是否显示3D/2D选择器
        contextOptions: {
            webgl: {
                alpha: true,
                depth: true,
                stencil: true,
                antialias: true,
                premultipliedAlpha: true,
                //通过canvas.toDataURL()实现截图需要将该项设置为true
                preserveDrawingBuffer: true,
                failIfMajorPerformanceCaveat: true
            }
        }

    });

    //逐点渲染rsrp   116.3288172392 39.9056952259


<%  int k=0;
    double lang1=116.3288172392;
    double lat1 = 39.9056952259;


for(int j = 0; j <10; j++) {
    for(int i = 0; i <665; i++) {


%>


    // for (let lang = 116.3288172392; lang <= 116.3452422392; lang += 0.00045) {  //画表
    //     for (let lat = 39.9056952259; lat <= 39.9356202259; lat += 0.00045) {

            var zfx = viewer.entities.add({  //画正方形

                polygon: {
                    hierarchy: Cesium.Cartesian3.fromDegreesArray([
                        <%=lang1%> - 0.0000225, <%=lat1%> - 0.0000225, <%=lang1%> - 0.0000225, <%=lat1%> + 0.0000225, <%=lang1%> + 0.0000225,
                        <%=lat1%> + 0.0000225, <%=lang1%> + 0.0000225, <%=lat1%> - 0.0000225]
                    ),
                    extrudedHeight: 0,
                    height: 0,
                    material: Cesium.Color.fromBytes(<%=color[rsrp[k]][0]%>,<%=color[rsrp[k]][1]%>,<%=color[rsrp[k]][2]%>,<%=color[rsrp[k]][3]%>),
<%--                                        <%System.out.print(color[rsrp[k]][0]);--%>
<%--                                        System.out.print(color[rsrp[k]][1]);--%>
<%--                                        System.out.print(color[rsrp[k]][2]);--%>
<%--                                        System.out.println(k);--%>
<%--                                        System.out.println(" ");--%>
<%--                                        %>--%>
                    <%--               参数传递测试 成功     %>--%>
                    outline: false,
                    outlineWidth: 100000,
                    outlineColor: Cesium.Color.BLACK,

                },

            });





<%
    k++;
    lang1+=0.000045;}

    lang1=116.3288172392;
    lat1+=0.000045;
    }
%>

    //     }
    // }



    viewer.zoomTo(zfx);
</script>




</body>
</html>